﻿#define _CRT_SECURE_NO_WARNINGS 1


#include <iostream>
#include <vector>
#include <string>

using namespace std;

class Solution
{
public:
    int brokenCalc(int startValue, int target)
    {
        // 正难则反 + 贪⼼
        int ret = 0;
        while (target > startValue)
        {
            if (target % 2 == 0) target /= 2;
            else target += 1;
            ret++;
        }
        return ret + startValue - target;
    }
};

int main()
{
    int startValue = 2, target = 3;

    cout << Solution().brokenCalc(startValue, target) << endl;

    return 0;
}


